"""
Clase que representa un blob

Autor: Gonzalo Luzardo Morocho
gluzardo@espol.edu.ec, gonchalox@gmail.com
"""

from matplotlib.patches import Rectangle
import random

class Blob:
	def __init__(self,px,py,id):
		self._id=id #etiqueta del blob
		self._xMin=px
		self._xMax=px
		self._yMin=py
		self._yMax=py
		self._width=1
		self._height=1
		self._points=1 
		self.getRandomColor()

	def getRandomColor(self):
		r = random.random()
		g = random.random()
		b = random.random()
		self._color = (r,g,b)
		
	def addPoint(self,px,py):
		if(px<self._xMin):
			self._xMin=px
		if(px>self._xMax):
			self._xMax=px
		
		if(py<self._yMin):
			self._yMin=py
		if(py>self._yMax):
			self._yMax=py
		
		self._width = self._xMax - self._xMin
		self._height = self._yMax - self._yMin
		self._points = self._points + 1

